<template>
  <el-menu
    default-active="/Bg/PicRec"
    @open="handleOpen"
    @close="handleClose"
    router
    class="no-border"
    background-color="#545c64"
    text-color="#fff"
    active-text-color="#ffd04b"
  >
    <el-submenu index="123">
      <template slot="title"><i class="el-icon-message"></i>机器学习</template>
      <el-menu-item index="/Bg/PicRec">图像识别</el-menu-item>
      <el-menu-item index="/about">目标检测</el-menu-item>
      <el-menu-item>选项3</el-menu-item>
      <el-submenu>
        <template slot="title">选项4</template>
        <el-menu-item index="1-4-1">选项4-1</el-menu-item>
      </el-submenu>
    </el-submenu>
    <el-submenu index="2">
      <template slot="title"><i class="el-icon-menu"></i>导航二</template>
      <el-menu-item index="2-1">选项1</el-menu-item>
      <el-menu-item index="2-2">选项2</el-menu-item>
      <el-menu-item index="2-3">选项3</el-menu-item>
      <el-submenu index="2-4">
        <template slot="title">选项4</template>
        <el-menu-item index="2-4-1">选项4-1</el-menu-item>
      </el-submenu>
    </el-submenu>
    <el-submenu index="3">
      <template slot="title"><i class="el-icon-setting"></i>导航三</template>
      <el-menu-item index="3-1">选项1</el-menu-item>
      <el-menu-item index="3-2">选项2</el-menu-item>
      <el-menu-item index="3-3">选项3</el-menu-item>
      <el-submenu index="3-4">
        <template slot="title">选项4</template>
        <el-menu-item index="3-4-1">选项4-1</el-menu-item>
      </el-submenu>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: 'MainMenu',
  props: {
    menu: Object
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    }
  },
  data: function () {
    return {
      menu_temp: [
        {
          title: '1',
          icon: 'el-icon-message',
          children: [
            {
              title: '1-1'
            },
            {
              title: '1-2'
            }
          ]
        },
        {
          title: '2',
          icon: 'el-icon-menu',
          children: [
            {
              title: '2-1'
            },
            {
              title: '2-2'
            }
          ]
        },
        {
          title: '3',
          icon: 'el-icon-setting',
          children: [
            {
              title: '3-1'
            },
            {
              title: '3-2'
            }
          ]
        }
      ]
    }
  }
}
</script>

<style scoped lang="less">
  @import "../style/main.less";
  .no-border{
    border: 0px;
  }
</style>
